﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mindfor.Web.Routing
{
	/// <summary>
	/// Defines controller name that will be used in URL creating by default.
	/// </summary>
	[AttributeUsage(AttributeTargets.Class, Inherited=false, AllowMultiple=false)]
	public class UrlControllerNameAttribute : Attribute
	{
		string m_name;

		/// <summary>
		/// Gets or sets url controller name.
		/// </summary>
		public string Name
		{
			get { return m_name; }
			set
			{
				if (String.IsNullOrEmpty(value))
					throw new ArgumentNullException("name", "Url controller name can not be null or empty.");
				m_name = value;
			}
		}

		/// <summary>
		/// Defines controller name that will be used in URL creating by default.
		/// </summary>
		/// <param name="name">Controller name that will be used in URL.</param>
		public UrlControllerNameAttribute(string name)
		{
			Name = name;
		}
	}
}
